//
//  PersonController.m
//  projectBase
//
//  Created by zhuangzhh on 15/5/8.
//  Copyright (c) 2015年 zhuangzhh. All rights reserved.
//

#import "PersonController.h"
#import "AppDelegate.h"
#import "UIButton+WebCache.h"
#import "LKDBHelper.h"
#import "PreviewImageView.h"
#import "SizeHeader.h"
#import "EMHint.h"
#import "JXButton.h"
#import "UIView+BadgeValue.h"
#import "UIImageView+ZFBadge.h"
#import "UIButton+ZFBadge.h"

#define YiTuiKuangBtnTag   19997
#define DaiPingJiaBtnTag   19999
#define DaiZhiFuBtnTag     20000
#define DaiFaHuoBtnTag     20001
#define DaiShouHouBtnTag   20002
#define CollectBtnTag      20003
#define ModifyBtnTag       20004
#define CameraBtnTag       20005
#define ExitBtnTag         20006
#define LineWidth          .6
#define DaiZhiFuLabTag     40001
#define DaiFaHuoLabTag     40002
#define DaiShouHuoLabTag   40003
#define ShopBagLabTag      40004
#define SettingBtnTag      40005
#define DaiPingJiaLabTag   40006
#define THSHLabTag         40007

#define MYCOLLECTBTNTAG    50000
#define COINBTNTAG         50001
#define GIFTBTNTAG         50002
#define ABOUTBTNTAG        50003
#define SUGGESTBTNTAG      50004
#define SHOPBTNTAG         50005

#define JIAOBIAO1         120005
#define JIAOBIAO2         12000006
#define JIAOBIAO3         120007
#define JIAOBIAO4         120008
#define JIAOBIAO5         120009


@interface PersonController ()<UITableViewDataSource,UITableViewDelegate,EMHintDelegate>
{
    EMHint *_hint;
    id _info;
}
//列表
@property (nonatomic,retain) UITableView *tableView;
@property(nonatomic,strong) OrderStatusCell *orderStatusCell;

@end

@implementation PersonController

-(void)initUI
{
    [super initUI];
//    topView.alpha = 0;
    self.view.backgroundColor = [UIColor whiteColor];
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,ScreenWidth,ScreenHeight-49) style:UITableViewStylePlain];
    NSLog(@"%f",ScreenHeight);
    NSLog(@"%f",self.view.frame.size.height);
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.bounces = NO;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_tableView];
    
    _hint = [[EMHint alloc] init];
    [_hint setHintDelegate:self];
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
    if(indexPath.section == 3)
    {
        //关于我们
        if(indexPath.row == 1)
        {
//            mineCongtroller *vc=  [[mineCongtroller alloc] init];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//            return;
        }
        //分享应用
        else if (indexPath.row == 0)
        {
            /*
            [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeText;
            [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeDefault;
            [UMSocialSnsService presentSnsIconSheetView:self
                                                         appKey:UmengAppkey
                                              shareText:[NSString stringWithFormat:@"我正在使用怡康乐手机客户端，安卓版本下载地址：%@，苹果版本下载地址：%@",@"http://pre.im/x374",@"http://pre.im/Jtp5"]
                                                     shareImage:nil
                                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToQQ,UMShareToWechatTimeline,nil]
                                                       delegate:self];
            return;
             */
        }
        else
        {
            UIAlertView *a=[[UIAlertView alloc] initWithTitle:@"确定要退出登录？"message:nil delegate:self cancelButtonTitle:@"确定"otherButtonTitles: @"取消",nil];
            [a show];
        }

    }
    if(indexPath.section == 1)
    {
        if(indexPath.row == 0)
        {
//            MyOrderController *vc = [[MyOrderController alloc] init];
//            vc.orderStatus = @"0";
//            vc.orderTitle = @"全部订单";
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];

        }
        else if(indexPath.row == 1)
        {
//            AboutController *vc=  [[AboutController alloc] init];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
        }
        else if (indexPath.row == 2)
        {
            NSString *telUrl = [NSString stringWithFormat:@"tel:%@",[AppData shareInstance].serviceCell.phone];
 
            NSURL *url = [[NSURL alloc] initWithString:telUrl];

            [[UIApplication sharedApplication] openURL:url];
        }
    }
    else if (indexPath.section == 2)
    {
        if(indexPath.row == 0)
        {
//            MyCollectController *vc = [[MyCollectController alloc] init];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
        }
        else if (indexPath.row == 1)
        {
//            AddressController *vc = [[AddressController alloc] init];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
        }
        else if (indexPath.row == 2)
        {
//            SuggestController *vc= [[SuggestController alloc] init];
//            [vc setBackBtnHide:NO];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
            return;
        }
//        else if (indexPath.row == 3)
//        {
//            [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"isfirst"];
//            [[NSNotificationCenter defaultCenter] postNotificationName:Notify_TabBarOfIndex
//                                                                object:[NSNumber numberWithInt:0]];
//
////            CoinShopController *vc = [[CoinShopController alloc] init];
////            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//        }
//        else if (indexPath.row == 4)
//        {
//            SkinSelectController *vc = [[SkinSelectController alloc] init];
//            [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//        }
    }
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}


//
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSString *skin = [[NSUserDefaults standardUserDefaults] objectForKey:@"skin"];
//    if([skin isEqualToString:@"2"])
//    {
//        if(section == 0)
//            return 1;
//        else if (section == 1)
//        {
//            return 2;
//        }
//        else if (section == 2)
//        {
//            return 1;
//        }
//        if(section == 3)
//            return 3;
//        return 1;
//    }
    
    
    if(section == 0)
        return 1;
    else if (section == 1)
    {
        return 2;
    }
    else if (section == 2)
    {
        return 2;
    }
    else if(section == 3)
        return 3;
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [self GetTableViewCellSkinOne:indexPath tableview:tableView];
    return cell;
}

-(UITableViewCell *)GetTableViewCellSkinOne:(NSIndexPath *)indexPath tableview:(UITableView *)tableView
{
    if(indexPath.section == 0)
    {
        NSString *CellIdentifierMore = @"oneSection";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierMore];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierMore] ;
            UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 175)];
            bgView.backgroundColor = MainColor;
            bgView.alpha= .8;
            [cell addSubview:bgView];
            
//            UIButton *bgImage = [self createBtn:CGRectMake(0, 0, ScreenWidth, 155) title:nil iconImage:nil backgroundImage:nil tag:CameraBtnTag textColor:nil];
            UIImageView *bgImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 175)];
            bgImage.image = [UIImage imageNamed:@"331_personal_bg_two"];
            [cell addSubview:bgImage];

            
            UILabel *titleLab = [self createLabel:CGRectMake(ScreenWidth/2-100, 25, 200, 30) title:@"个人中心" fontSize:18 textColor:[UIColor whiteColor]];
            titleLab.textAlignment = NSTextAlignmentCenter;
            [cell addSubview:titleLab];
            
            
            UIButton *settingBtn = [self createBtn:CGRectMake(ScreenWidth-44, 23, 44, 40) title:nil iconImage:[UIImage imageNamed:@"4_28_personal_setting"] backgroundImage:nil tag:SettingBtnTag textColor:nil];
            _info =settingBtn;
            [cell addSubview:settingBtn];
            
            UIButton *personImage = [self createBtn:CGRectMake(16, 80, 70,70) title:nil iconImage:nil backgroundImage:nil tag:503030 textColor:nil];
            [personImage setImage:[UIImage imageNamed:@"new_personal_head"] forState:UIControlStateNormal];
            personImage.layer.masksToBounds = YES;
            personImage.layer.cornerRadius = 35;
            personImage.backgroundColor = [UIColor whiteColor];
//            personImage.tag = CameraBtnTag;
            [cell addSubview:personImage];
            
            NSString *uname = [[NSUserDefaults standardUserDefaults]objectForKey:@"username"];
            UILabel *nameLab = [self createLabel:CGRectMake(personImage.frame.size.width+personImage.frame.origin.x+10, personImage.frame.origin.y+12, 200, 17) title:uname fontSize:13 textColor:[UIColor whiteColor]];
            nameLab.tag = 1001;
            [cell addSubview:nameLab];
            
        
            
//            UILabel *phoneLab = [self createLabel:CGRectMake(nameLab.frame.origin.x, nameLab.frame.size.height+nameLab.frame.origin.y+7, nameLab.frame.size.width,14) title:[AppData shareInstance].personCell.alias fontSize:14 textColor:[UIColor whiteColor]];
//            phoneLab.tag = 1002;
//            [cell addSubview:phoneLab];
            
            UIImageView *vipImage = [[UIImageView alloc]initWithFrame:CGRectMake(nameLab.frame.origin.x, nameLab.frame.size.height+nameLab.frame.origin.y+10, 12,11)];
            vipImage.image = [UIImage imageNamed:@"new_personal_vip"];
            [cell addSubview:vipImage];
        }
        UIButton *personImage = [cell viewWithTag:503030];
        UILabel *nameLab = [cell viewWithTag:1001];
        if([[NSUserDefaults standardUserDefaults] objectForKey:@"autologin"]!=nil)
        {
            if([[[NSUserDefaults standardUserDefaults] objectForKey:@"isthird"] isEqualToString:@"1"])
            {
                NSString *user_img =[[NSUserDefaults standardUserDefaults]objectForKey:@"third_userimg"];
                NSString *third_username = [[NSUserDefaults standardUserDefaults]objectForKey:@"alias"];
                [personImage setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",user_img]] placeholderImage:[UIImage imageNamed:@"new_personal_head"]];
                nameLab.text = third_username;
            }
            else
            {
                NSString *user_img =[[NSUserDefaults standardUserDefaults]objectForKey:@"user_img"];
                NSString *third_username = [[NSUserDefaults standardUserDefaults]objectForKey:@"alias"];
                [personImage setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",user_img]] placeholderImage:[UIImage imageNamed:@"new_personal_head"]];
                nameLab.text = third_username;
            }
        }
//        NSString *isthird = [[NSUserDefaults standardUserDefaults]objectForKey:@"isthird"];
//        
//        if ([isthird isEqualToString:@"1"])
//        {
//            [personImage setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",user_img]] placeholderImage:[UIImage imageNamed:@"new_personal_head"]];
////            personImage.imageView.image = [UIImage imageNamed:@"order_delete"];
////            [personImage.imageView setImageWithURL:[NSURL URLWithString:user_img] placeholderImage:[UIImage imageNamed:@"new_personal_head"]];
//            nameLab.text = third_username;
//        }
        
        
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
//        if([AppData shareInstance].personCell != nil)
//        {
//            UILabel *nameLab = (UILabel *)[cell viewWithTag:1001];
//            UILabel *phoneLab = (UILabel *)[cell viewWithTag:1002];
//            UIButton *personImage = (UIButton *)[cell viewWithTag:CameraBtnTag];
//            [personImage setImageWithURL:[AppData shareInstance].personCell.user_img placeholderImage:[PubFunction GetSkinImage:@"chatfrom_doctor_icon"]];
//            nameLab.text = [AppData shareInstance].personCell.alias;
//            phoneLab.text = [AppData shareInstance].personCell.username;
//        }
        return cell;
    }
    else if(indexPath.section == 1)
    {
        if(indexPath.row == 0)
        {
            NSString *CellIdentifierMore = @"twoSectionofone";
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierMore];
            if (cell == nil)
            {
                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierMore] ;
                
                UILabel *tipLabel = [self createLabel:CGRectMake(10, 0, 100, 47) title:@"我的订单" fontSize:13 textColor:UIColorRGB(67)];
                [cell addSubview:tipLabel];
                
                UILabel *tipLabel2 = [self createLabel:CGRectMake(ScreenWidth-70, 0, 60, 47) title:@"查看全部" fontSize:10 textColor:UIColorRGB(132)];
                [cell addSubview:tipLabel2];
                
                [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
                
                UIView *line = [[UIView alloc] initWithFrame:CGRectMake(tipLabel.frame.origin.x, tipLabel.frame.size.height-.7, ScreenWidth, .7)];
                line.backgroundColor = [UIColor colorWithRed:234.0/255 green:233.0/255 blue:229.0/255 alpha:1.0];
                [cell addSubview:line];
                
            }
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
            return cell;
            
        }
        
        
        NSString *CellIdentifierMore = @"twoSectionoftwo";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierMore];
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierMore] ;
            
            //待付款
//            UIButton *dfkBtn = [self createBtn:CGRectMake(0, 0, ScreenWidth/5.0, 64) title:nil iconImage:nil backgroundImage:nil tag:0 textColor:nil];
//            dfkBtn.tag = DaiZhiFuBtnTag;
            
            
            JXButton *dfkBtn = [[JXButton alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth/5.0, 64)];
            dfkBtn.tag = DaiZhiFuBtnTag;
            [dfkBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            [cell addSubview:dfkBtn];
            
            
            
            UIImageView *dfknum = [[UIImageView alloc]initWithFrame:CGRectMake(23, 18, 20, 17)];
            dfknum.image = [UIImage imageNamed:@"4_28_personal_payment_two"];
            [dfkBtn addSubview:dfknum];
            
            
            UILabel *dfktip = [self createLabel:CGRectMake(0, dfknum.frame.size.height+dfknum.frame.origin.y+6, dfkBtn.frame.size.width, 14) title:@"待付款" fontSize:11 textColor:UIColorRGB(50)];
            dfktip.textAlignment = NSTextAlignmentCenter;
            [dfkBtn addSubview:dfktip];
            
            UILabel *line0 = [self createLabel:CGRectMake(dfkBtn.frame.origin.x+dfkBtn.frame.size.width+1, 10, 1, dfkBtn.frame.size.height-20) title:nil fontSize:1 textColor:UIColorRGB(222)];
            [cell addSubview:line0];

            //角标1
            UILabel *jiaobiao1 = [self createLabel:CGRectMake(dfkBtn.frame.size.width/2+8, dfkBtn.frame.size.height/2-25, 15, 15) title:@"10" fontSize:9 textColor:MainColor];
            jiaobiao1.tag = JIAOBIAO1;
            jiaobiao1.hidden = YES;
            jiaobiao1.textAlignment = NSTextAlignmentCenter;
            jiaobiao1.backgroundColor = [UIColor whiteColor];
            jiaobiao1.layer.cornerRadius=7.5;
            jiaobiao1.layer.masksToBounds=YES;
            jiaobiao1.layer.borderWidth=1;
            jiaobiao1.layer.borderColor = [[UIColor colorWithRed:0.0/255 green:165.0/255 blue:65.0/255.0 alpha:.5] CGColor];
            [dfkBtn addSubview:jiaobiao1];
            
            
            //待发货
//            UIButton *dfhBtn = [self createBtn:CGRectMake(dfkBtn.frame.size.width, 0, ScreenWidth/5.0, dfkBtn.frame.size.height) title:nil iconImage:nil backgroundImage:nil tag:DaiFaHuoBtnTag textColor:nil];
//            [cell addSubview:dfhBtn];
            
            JXButton *dfhBtn = [[JXButton alloc] initWithFrame:CGRectMake(dfkBtn.frame.size.width, 0, ScreenWidth/5.0, dfkBtn.frame.size.height)];
            dfhBtn.tag = DaiFaHuoBtnTag;
//            dfhBtn.badgeValue = @"1";
            [dfhBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            [cell addSubview:dfhBtn];
            
            
            UIImageView *dfhnum = [[UIImageView alloc]initWithFrame:CGRectMake(dfknum.frame.origin.x, 18, dfknum.frame.size.width, dfknum.frame.size.height)];
            dfhnum.image = [UIImage imageNamed:@"4_28_personal_deliver_two"];
            [dfhBtn addSubview:dfhnum];
            
//            UILabel *dfhnum = [self createLabel:CGRectMake(0, 15, dfkBtn.frame.size.width, dfknum.frame.size.height) title:@"0" fontSize:14 textColor:UIColorRGB(40)];
//            dfhnum.font = [UIFont boldSystemFontOfSize:16];
//            dfhnum.textAlignment = NSTextAlignmentCenter;
//            dfhnum.tag = DaiFaHuoLabTag;
//            [dfhBtn addSubview:dfhnum];
            
            UILabel *dfhtip = [self createLabel:CGRectMake(0, dfknum.frame.size.height+dfknum.frame.origin.y+6, dfhBtn.frame.size.width, 14) title:@"待发货" fontSize:11 textColor:dfktip.textColor];
            dfhtip.textAlignment = NSTextAlignmentCenter;
            [dfhBtn addSubview:dfhtip];
            
            UILabel *line2 = [self createLabel:CGRectMake(dfhBtn.frame.origin.x+dfhBtn.frame.size.width+1, 10, 1, dfhBtn.frame.size.height-20) title:nil fontSize:1 textColor:UIColorRGB(222)];
            [cell addSubview:line2];
            
            //角标2
            UILabel *jiaobiao2 = [self createLabel:CGRectMake(dfhBtn.frame.size.width/2+8, dfhBtn.frame.size.height/2-25, 15, 15) title:@"10" fontSize:9 textColor:MainColor];
            jiaobiao2.tag = JIAOBIAO2;
            jiaobiao2.hidden = YES;
            jiaobiao2.textAlignment = NSTextAlignmentCenter;
            jiaobiao2.backgroundColor = [UIColor whiteColor];
            jiaobiao2.layer.cornerRadius=7.5;
            jiaobiao2.layer.masksToBounds=YES;
            jiaobiao2.layer.borderWidth=1;
            jiaobiao2.layer.borderColor = [[UIColor colorWithRed:0.0/255 green:165.0/255 blue:65.0/255.0 alpha:.5] CGColor];
            [dfhBtn addSubview:jiaobiao2];

            
            //待收货
//            UIButton *dshBtn = [self createBtn:CGRectMake(dfhBtn.frame.size.width+dfhBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height) title:nil iconImage:nil backgroundImage:nil tag:0 textColor:nil];
//            dshBtn.tag = DaiShouHouBtnTag;
//            [cell addSubview:dshBtn];
            
            JXButton *dshBtn = [[JXButton alloc] initWithFrame:CGRectMake(dfhBtn.frame.size.width+dfhBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height)];
            dshBtn.tag = DaiShouHouBtnTag;
//            dshBtn.badgeValue = @"1";
            [dshBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            [cell addSubview:dshBtn];
            
            UIImageView *dshnum = [[UIImageView alloc]initWithFrame:CGRectMake(dfknum.frame.origin.x, 18, dfknum.frame.size.width, dfknum.frame.size.height)];
            dshnum.image = [UIImage imageNamed:@"4_28_personal_receive_two"];
            [dshBtn addSubview:dshnum];
//            UILabel *dshnum = [self createLabel:CGRectMake(0, 15, dfkBtn.frame.size.width, dfknum.frame.size.height) title:@"0" fontSize:14 textColor:UIColorRGB(40)];
//            dshnum.font = dfktip.font;
//            dshnum.tag = DaiShouHuoLabTag;
//            dshnum.textAlignment = NSTextAlignmentCenter;
//            [dshBtn addSubview:dshnum];
            
            UILabel *dshtip = [self createLabel:CGRectMake(0, dfknum.frame.size.height+dfknum.frame.origin.y+6, dfhBtn.frame.size.width, 14) title:@"待收货" fontSize:11 textColor:dfktip.textColor];
            dshtip.textAlignment = NSTextAlignmentCenter;
            [dshBtn addSubview:dshtip];
            
            UILabel *line3 = [self createLabel:CGRectMake(dshBtn.frame.origin.x+dshBtn.frame.size.width+1, 10, 1, dfhBtn.frame.size.height-20) title:nil fontSize:1 textColor:UIColorRGB(222)];
            [cell addSubview:line3];

            //角标3
            UILabel *jiaobiao3 = [self createLabel:CGRectMake(dshBtn.frame.size.width/2+8, dshBtn.frame.size.height/2-25, 15, 15) title:@"10" fontSize:9 textColor:MainColor];
            jiaobiao3.tag = JIAOBIAO3;
            jiaobiao3.hidden = YES;
            jiaobiao3.textAlignment = NSTextAlignmentCenter;
            jiaobiao3.backgroundColor = [UIColor whiteColor];
            jiaobiao3.layer.cornerRadius=7.5;
            jiaobiao3.layer.masksToBounds=YES;
            jiaobiao3.layer.borderWidth=1;
            jiaobiao3.layer.borderColor = [[UIColor colorWithRed:0.0/255 green:165.0/255 blue:65.0/255.0 alpha:.5] CGColor];
            [dshBtn addSubview:jiaobiao3];
            
            //待评价
//            UIButton *dpjBtn = [self createBtn:CGRectMake(dshBtn.frame.size.width+dshBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height) title:nil iconImage:nil backgroundImage:nil tag:0 textColor:nil];
//            dpjBtn.tag = DaiPingJiaBtnTag;
//            [cell addSubview:dpjBtn];
            
            JXButton *dpjBtn = [[JXButton alloc] initWithFrame:CGRectMake(dshBtn.frame.size.width+dshBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height)];
            dpjBtn.tag = DaiPingJiaBtnTag;
//            dpjBtn.badgeValue = @"1";
            [dpjBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            [cell addSubview:dpjBtn];
            
            UIImageView *dpjnum = [[UIImageView alloc]initWithFrame:CGRectMake(dfknum.frame.origin.x, 18, 18, 17)];
            dpjnum.image = [UIImage imageNamed:@"4_28_personal_evaluate_two"];
            [dpjBtn addSubview:dpjnum];
//            UILabel *dpjnum = [self createLabel:CGRectMake(0, 15, dfkBtn.frame.size.width, dfknum.frame.size.height) title:@"0" fontSize:14 textColor:UIColorRGB(40)];
//            dpjnum.font = dfktip.font;
//            dpjnum.tag = DaiPingJiaLabTag;
//            dpjnum.textAlignment = NSTextAlignmentCenter;
//            [dpjBtn addSubview:dpjnum];
            
            
            UILabel *dpjtip = [self createLabel:CGRectMake(0, dfknum.frame.size.height+dfknum.frame.origin.y+6, dfhBtn.frame.size.width, 14) title:@"待评价" fontSize:11 textColor:dfktip.textColor];
            dpjtip.textAlignment = NSTextAlignmentCenter;
            [dpjBtn addSubview:dpjtip];
            
            UILabel *line4 = [self createLabel:CGRectMake(dpjBtn.frame.origin.x+dpjBtn.frame.size.width+1, 10, 1, dfhBtn.frame.size.height-20) title:nil fontSize:1 textColor:UIColorRGB(222)];
            [cell addSubview:line4];
            
            //角标4
            UILabel *jiaobiao4 = [self createLabel:CGRectMake(dpjBtn.frame.size.width/2+8, dpjBtn.frame.size.height/2-25, 15, 15) title:@"10" fontSize:9 textColor:MainColor];
            jiaobiao4.tag = JIAOBIAO4;
            jiaobiao4.hidden = YES;
            jiaobiao4.textAlignment = NSTextAlignmentCenter;
            jiaobiao4.backgroundColor = [UIColor whiteColor];
            jiaobiao4.layer.cornerRadius=7.5;
            jiaobiao4.layer.masksToBounds=YES;
            jiaobiao4.layer.borderWidth=1;
            jiaobiao4.layer.borderColor = [[UIColor colorWithRed:0.0/255 green:165.0/255 blue:65.0/255.0 alpha:.5] CGColor];
            [dpjBtn addSubview:jiaobiao4];
            
            //退款售后
//            UIButton *tkshBtn = [self createBtn:CGRectMake(dpjBtn.frame.size.width+dpjBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height) title:nil iconImage:nil backgroundImage:nil tag:0 textColor:nil];
//            tkshBtn.tag = YiTuiKuangBtnTag;
//            [cell addSubview:tkshBtn];
            
            JXButton *tkshBtn = [[JXButton alloc] initWithFrame:CGRectMake(dpjBtn.frame.size.width+dpjBtn.frame.origin.x, 0, ScreenWidth/5.0, dfkBtn.frame.size.height)];
            tkshBtn.tag = YiTuiKuangBtnTag;
//            tkshBtn.badgeValue = @"1";
            [tkshBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            [cell addSubview:tkshBtn];
            
            
            UIImageView *tkshnum = [[UIImageView alloc]initWithFrame:CGRectMake(dfknum.frame.origin.x+4, 15, 18, 20)];
            tkshnum.image = [UIImage imageNamed:@"4_28_personal_aftersale_two"];
            [tkshBtn addSubview:tkshnum];
            
//            UILabel *tkshnum = [self createLabel:CGRectMake(0, 15, dfkBtn.frame.size.width, dfknum.frame.size.height) title:@"0" fontSize:14 textColor:UIColorRGB(40)];
//            tkshnum.font = dfktip.font;
//            tkshnum.tag = THSHLabTag;
//            tkshnum.textAlignment = NSTextAlignmentCenter;
//            [tkshBtn addSubview:tkshnum];
            
            UILabel *tkshtip = [self createLabel:CGRectMake(0, dfknum.frame.size.height+dfknum.frame.origin.y+6, dfhBtn.frame.size.width, 14) title:@" 退款/售后" fontSize:11 textColor:dfktip.textColor];
            tkshtip.textAlignment = NSTextAlignmentCenter;
            [tkshBtn addSubview:tkshtip];
            
            //角标5
            UILabel *jiaobiao5 = [self createLabel:CGRectMake(tkshBtn.frame.size.width/2+8, tkshBtn.frame.size.height/2-25, 15, 15) title:@"10" fontSize:9 textColor:MainColor];
            jiaobiao5.hidden = YES;
            jiaobiao5.tag = JIAOBIAO5;
            jiaobiao5.textAlignment = NSTextAlignmentCenter;
            jiaobiao5.backgroundColor = [UIColor whiteColor];
            jiaobiao5.layer.cornerRadius=7.5;
            jiaobiao5.layer.masksToBounds=YES;
            jiaobiao5.layer.borderWidth=1;
            jiaobiao5.layer.borderColor = [[UIColor colorWithRed:0.0/255 green:165.0/255 blue:65.0/255.0 alpha:.5] CGColor];
            [tkshBtn addSubview:jiaobiao5];
            
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
        
    }
    else if(indexPath.section == 2||indexPath.section == 3)
    {
        NSString *CellIdentifierMore = @"threeSection";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierMore];
        if (cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierMore] ;
            
            UIImageView *iconView= [[UIImageView alloc] initWithFrame:CGRectMake(13,(47-16)/2.0, 16, 16)];
            iconView.tag = 20000;
            [cell addSubview:iconView];
            //
            UILabel *tiplab = [self createLabel:CGRectMake(8+iconView.frame.size.width+iconView.frame.origin.x, 0, 100, 47) title:nil fontSize:12 textColor:[UIColor blackColor]];
            tiplab.tag = 20001;
            [cell addSubview:tiplab];
            
            [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
            
            UIView *line = [[UIView alloc] initWithFrame:CGRectMake(10, 47-LineWidth, ScreenWidth, LineWidth)];
            line.backgroundColor = [UIColor colorWithRed:234.0/255 green:233.0/255 blue:229.0/255 alpha:1.0];
            [cell addSubview:line];
            
        }
        
        UIImageView *iconView = (UIImageView *)[cell viewWithTag:20000];
        UILabel *tipLab = (UILabel *)[cell viewWithTag:20001];
        if(indexPath.section == 2)
        {
            if(indexPath.row == 0)
            {
                tipLab.text = @"我的收藏";
                iconView.image =[UIImage imageNamed:@"geren_personal_collect"];
            }
            else if (indexPath.row == 1)
            {
                tipLab.text = @"收货地址";
                iconView.image =[UIImage imageNamed:@"new_personal_address"];
                
            }
            else if (indexPath.row == 2)
            {
                tipLab.text = @"意见反馈";
                iconView.image =[UIImage imageNamed:@"new_personal_opinion"];
                
            }
//            else if (indexPath.row == 3)
//            {
//                tipLab.text = @"新手引导";
//                iconView.image = [PubFunction GetSkinImage:@"jfsc_icon"];
//            }
//            else if (indexPath.row == 4)
//            {
//                tipLab.text = @"切换主题";
//                iconView.image = [PubFunction GetSkinImage:@"jfsc_icon"];
//            }
        }
        
        else if(indexPath.section == 3)
        {
            if(indexPath.row == 0)
            {
                tipLab.text = @"应用分享";
                iconView.image =[UIImage imageNamed:@"new_personal_share"];
            }
            else if (indexPath.row == 1)
            {
                tipLab.text = @"关于我们";
                iconView.image =[UIImage imageNamed:@"new_personal_aboutus"];
                
            }
            else if (indexPath.row == 2)
            {
                tipLab.text = @"退出登录";
                iconView.image =[UIImage imageNamed:@"new_personal_exit"];
                
            }
        }
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        return cell;
        
    }
    
    NSString *CellIdentifierMore = @"fiveSection";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierMore];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierMore] ;
        
        
    }
    
    return cell;
}





- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 4;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    NSString *skin = [[NSUserDefaults standardUserDefaults] objectForKey:@"skin"];
    if([skin isEqualToString:@"2"])
    {
        return 0;
    }
  if(section == 0)
      return 0;
    return 7;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 7)];
    view.backgroundColor = MainBgColor;
    return view;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *skin = [[NSUserDefaults standardUserDefaults] objectForKey:@"skin"];
    if([skin isEqualToString:@"2"])
    {
        if(indexPath.section == 2||indexPath.section == 3)
        {
            return 2*(ScreenWidth/3.0);
        }
    }
    
    if(indexPath.section == 0)
    {
        return 175;
    }
    else if(indexPath.section == 1)
        if(indexPath.row == 1)
            return 64;
    return 47;
}


-(void)btnAction:(id)sender
{
    UIButton *btn = (UIButton *)sender;
    NSInteger tag = [btn tag];
    if(tag == SHOPBTNTAG)
    {
        [self showTipInfo:@"正在建设中..."];
        return;
    }
    if(tag == MYCOLLECTBTNTAG)
    {
//        MyCollectController *vc = [[MyCollectController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//        return;
    }
    if(tag == COINBTNTAG)
    {
//        IntegrationController *vc = [[IntegrationController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//        return;
    }
    if(tag == GIFTBTNTAG)
    {
//        GiftController *vc = [[GiftController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
//        return;
    }
    if(tag == ABOUTBTNTAG)
    {
//        AboutController *vc= [[AboutController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    if(tag == CameraBtnTag)
    {
        UIWindow *windows = [UIApplication sharedApplication].keyWindow;
        CGRect startRect = [btn.imageView convertRect:btn.imageView.frame toView:windows];
        [PreviewImageView showPreviewImage:btn.imageView.image startImageFrame:startRect inView:windows viewFrame:self.view.bounds];
//        [self showSelectImageView];
        return;
    }
    else if(tag == CollectBtnTag)
    {
        for(int index = 0;index < [[ViewManager shareInstance].NavigationController.viewControllers count];index++)
        {
            UIViewController *vc = [[ViewManager shareInstance].NavigationController.viewControllers objectAtIndex:index];
            if([vc isKindOfClass:[YMTTabBarController class]])
            {
                YMTTabBarController *v = (YMTTabBarController *)vc;
                [v setSelectedIndex:2];
            }
        }
    }
    else if (tag == ModifyBtnTag)
    {
//        ModifyPwdController *vc = [[ModifyPwdController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    //退出登录
    else if (tag == ExitBtnTag)
    {
        UIAlertView *a=[[UIAlertView alloc] initWithTitle:@"确定要退出登录？"message:nil delegate:self cancelButtonTitle:@"确定"otherButtonTitles: @"取消",nil];
        [a show];
    }
    else if (tag == DaiZhiFuBtnTag)
    {
//        MyOrderController *vc = [[MyOrderController alloc] init];
//        vc.orderStatus = @"0";
//        vc.orderTitle = @"待支付";
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if (tag == DaiFaHuoBtnTag)
    {
//        MyOrderController *vc = [[MyOrderController alloc] init];
//        vc.orderStatus = @"1";
//        vc.orderTitle = @"待发货";
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if (tag == DaiPingJiaBtnTag)
    {
//        MyOrderController *vc = [[MyOrderController alloc] init];
//        vc.orderStatus = @"3";
//        vc.orderTitle = @"待评价";
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if (tag == DaiShouHouBtnTag)
    {
//        MyOrderController *vc = [[MyOrderController alloc] init];
//        vc.orderStatus = @"2";
//        vc.orderTitle = @"待收货";
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if(tag == YiTuiKuangBtnTag)
    {
//        MyOrderController *vc = [[MyOrderController alloc] init];
//        vc.orderStatus = @"5,6,7,8,9";
//        vc.orderTitle = @"退款/售后";
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if (tag == SettingBtnTag)
    {
//        SettingController *vc = [[SettingController alloc] init];
//        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
    }
    else if (tag == SUGGESTBTNTAG)
    {
        /*
        [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeText;
        [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeDefault;
        [UMSocialSnsService presentSnsIconSheetView:self
                                             appKey:UmengAppkey
                                          shareText:[NSString stringWithFormat:@"我正在使用怡康乐手机客户端，安卓版本下载地址：%@，苹果版本下载地址：%@",@"http://pre.im/x374",@"http://pre.im/Jtp5"]
                                         shareImage:nil
                                    shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToWechatSession,UMShareToQQ,UMShareToWechatTimeline,nil]
                                           delegate:self];
        return;
        */
    }
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
    if(buttonIndex == 0)
    {
        
        [AppData shareInstance].isLogin = NO;
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"autologin"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"userPhoneNum"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"userPassword"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"uid"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"username"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"third_userimg"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"third_alias"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"third_create_time"];
        [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"isthird"];
        [AppData shareInstance].personCell = nil;
        LoginController *vc = [[LoginController alloc] init];
        [[ViewManager shareInstance].NavigationController pushViewController:vc animated:YES];
        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        [[NSNotificationCenter defaultCenter] postNotificationName:Notify_TabBarOfIndex
                                                            object:[NSNumber numberWithInt:0]];
//        [appDelegate.tabBarViewController setSelectedIndex:0];
    }
    
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    NSString *uid = [[NSUserDefaults standardUserDefaults]objectForKey:@"uid"];
    [self selectUserInfo:uid];
    [self getOrderStatistics:uid];
    
    if([snapArray count]>0)
    {
        UIButton *cameraBtn = (UIButton *)[self.view viewWithTag:CameraBtnTag];
//        [[NSUserDefaults standardUserDefaults] setObject:[snapArray objectAtIndex:0] forKey:[AppData shareInstance].personCell.id];
        [cameraBtn setImage:[snapArray objectAtIndex:0] forState:UIControlStateNormal];
        [self uploadImage:UIImageJPEGRepresentation([snapArray objectAtIndex:0], .5)];
        [snapArray removeAllObjects];
    }
//    [self getTotals:[AppData shareInstance].personCell.id];
    [_tableView reloadData];
}

-(void)uploadImage:(NSData *)file
{
    [self showLoadViewExt:CGRectMake(0, 0, ScreenWidth, ScreenHeight-TopAndSystemHeight) backColor:[UIColor clearColor] info:@"正在上传图片中，请稍候..."];
    [[HttpBaseModel getInstance] uploadImageHostName:@"member/uploadImg.do" image:file params:[NSMutableDictionary dictionaryWithObject:@"file.jpg" forKey:@"key"] httpMethod:@"POST" onCompletion:^(NSData *responseData){
        
        [self closeLoadView];
        NSError *error = nil;
        id resultString = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
        if (error)
        {
            NSLog(@"dic->%@",error);
        }
        else
        {
            ResponseCell *response = [[ResponseCell alloc] initWithDictionary:resultString error:NULL];
            if(response.success == 1)
            {
                ResponseCell *response = [[ResponseCell alloc] initWithDictionary:resultString error:NULL];
                if(response.success == 1)
                {
//                    NSString *data = [resultString objectForKey:@"data"];
//                    [AppData shareInstance].personCell.headImg = data;
//                    [self setheadimage:data memberId:[AppData shareInstance].personCell.id];
                }
            }
            else
            {
                [self showTipInfo:response.msg];
            }
            
        }
        
        
        
    } onError:^(NSError *error){
        [self showTipInfo:@"网络异常，请重试！"];
        [self closeLoadView];
    }];
    
}

-(void)setheadimage:(NSString *)headImg memberId:(NSString *)memberId
{
    [self showLoadViewExt:CGRectMake(0, 0, ScreenWidth, ScreenHeight-TopAndSystemHeight) backColor:[UIColor clearColor] info:@"正在加载中，请稍候..."];
    [[HttpBaseModel getInstance] getDataResponsePath:[NSString stringWithFormat:@"member/updateMember.do?headImg=%@&memberId=%@",headImg,memberId] params:nil httpMethod:@"POST" onCompletion:^(NSData *responseData){
        
        [self closeLoadView];
        NSError *error = nil;
        id resultString = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
        if (error)
        {
            NSLog(@"dic->%@",error);
        }
        else
        {
            ResponseCell *response = [[ResponseCell alloc] initWithDictionary:resultString error:NULL];
            if(response.success == 1)
            {
                [_tableView reloadData];
                [self showTipInfo:@"头像更新成功！"];
            }
            else
            {
                [self showTipInfo:response.msg];
            }
            
        }
        
        
        
    } onError:^(NSError *error){
        [self showTipInfo:@"网络异常，请重试！"];
        [self closeLoadView];
    }];
    
}


-(void)selectUserInfo:(NSString *)user_id
{
    [[HttpBaseModel getInstance] getDataResponsePath:@"user/selectUserInfo" params:[NSMutableDictionary dictionaryWithObjectsAndKeys:user_id,@"user_id", nil] httpMethod:@"POST" onCompletion:^(NSData *responseData){
        
        [self closeLoadView];
        NSError *error = nil;
        id resultString = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
        if (error)
        {
            NSLog(@"dic->%@",error);
        }
        else
        {
            ResponseCell *response = [[ResponseCell alloc] initWithDictionary:resultString error:NULL];
            if(response.success == 1)
            {
                NSArray *array = [resultString objectForKey:@"data"];
                if([array count]>0)
                {
                    UIButton *personImage = [self.view viewWithTag:503030];
                    UILabel *nameLab = [self.view viewWithTag:1001];
                    
                    NSDictionary *param = [array objectAtIndex:0];
//
                    [personImage setImageWithURL:[NSURL URLWithString:[param objectForKey:@"user_img"]] placeholderImage:[UIImage imageNamed:@"moren"]];
                    
                    nameLab.text = [param objectForKey:@"alias"];
                    
                    [[NSUserDefaults standardUserDefaults]setObject:[param objectForKey:@"user_img"] forKey:@"user_img"];
//                    int count_yth = [[NSString stringWithFormat:@"%@",[param objectForKey:@"count_yth"]] intValue];
                    
                }

            }
            else
            {
                [self showTipInfo:response.msg];
            }
            
        }
        
        
        
    } onError:^(NSError *error){
        [self showTipInfo:@"网络异常，请重试！"];
        [self closeLoadView];
    }];
    
}


-(UIView*)hintStateViewToHint:(id)hintState
{
    return _info;
}
-(UIView*)hintStateViewForDialog:(id)hintState
{
    UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(50, 50, 200, 50)];
    
    [l setBackgroundColor:[UIColor clearColor]];
    [l setTextColor:[UIColor whiteColor]];
    [l setText:@"I am the info button!"];
    return l;
}


-(void)getOrderStatistics:(NSString *)uid
{
    NSMutableDictionary *param = [NSMutableDictionary dictionaryWithObjectsAndKeys:uid,@"user_id", nil];
    [[HttpBaseModel getInstance] getDataResponsePath:@"order/getOrderStatistics" params:param httpMethod:@"POST" onCompletion:^(NSData *responseData){
        
        [self closeLoadView];
        NSError *error = nil;
        id resultString = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&error];
        if (error)
        {
            NSLog(@"dic->%@",error);
        }
        else
        {
            ResponseCell *response = [[ResponseCell alloc] initWithDictionary:resultString error:NULL];
            if(response.success == 1)
            {
                NSArray *array = [resultString objectForKey:@"data"];
                
                
                UILabel *biaoqian1 = [self.view viewWithTag:JIAOBIAO1];
                UILabel *biaoqian2 = [self.view viewWithTag:JIAOBIAO2];
                UILabel *biaoqian3 = [self.view viewWithTag:JIAOBIAO3];
                UILabel *biaoqian4 = [self.view viewWithTag:JIAOBIAO4];
                UILabel *biaoqian5 = [self.view viewWithTag:JIAOBIAO5];
                
                if (array.count != 0)
                {
                    NSDictionary *dic = [array objectAtIndex:0];
                    biaoqian1.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"count_dzf"]];
                    if ([biaoqian1.text isEqualToString:@"0"] || [PubFunction stringIsNullOrEmpty:biaoqian1.text] )
                    {
                        biaoqian1.hidden = YES;
                    }
                    else
                    {
                        biaoqian1.hidden = NO;
                    }
                    
                    biaoqian2.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"count_dfh"]];
                    if ([biaoqian2.text isEqualToString:@"0"] || [PubFunction stringIsNullOrEmpty:biaoqian2.text])
                    {
                        biaoqian2.hidden = YES;
                    }
                    else
                    {
                        biaoqian2.hidden = NO;
                    }
                    
                    biaoqian3.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"count_dsf"]];
                    if ([biaoqian3.text isEqualToString:@"0"] || [PubFunction stringIsNullOrEmpty:biaoqian3.text])
                    {
                        biaoqian3.hidden = YES;
                    }
                    else
                    {
                        biaoqian3.hidden = NO;
                    }
                    
                    
                    biaoqian4.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"count_dpj"]];
                    if ([biaoqian4.text isEqualToString:@"0"] || [PubFunction stringIsNullOrEmpty:biaoqian4.text])
                    {
                        biaoqian4.hidden = YES;
                    }
                    else
                    {
                        biaoqian4.hidden = NO;
                    }
                    
                    
                    int type5 = [[dic objectForKey:@"count_dtk"] intValue];
                    int type6 = [[dic objectForKey:@"count_ytk"] intValue];
                    int type7 = [[dic objectForKey:@"count_tyth"] intValue];
                    int type8 = [[dic objectForKey:@"count_jjth"] intValue];
                    int type9 = [[dic objectForKey:@"count_sqth"] intValue];
                    int sum = type5 +type6 +type7 + type8 +type9;
                    
                    biaoqian5.text = [NSString stringWithFormat:@"%d",sum];
                    //退款／售后
                    if ([biaoqian5.text isEqualToString:@"0"] || [PubFunction stringIsNullOrEmpty:biaoqian5.text])
                    {
                        biaoqian5.hidden = YES;
                    }
                    else
                    {
                        biaoqian5.hidden = NO;
                    }
                }
                
//
//                count =  [[dic objectForKey:@"count"] intValue];
//                JXButton *btn = (JXButton *)[self.view viewWithTag:NOTIFYBTNTAG];
//                //                btn.badgeValue = [NSString stringWithFormat:@"%d",num];
//                if(count == 0)
//                {
//                    btn.fl_badgeValue = @"";
//                }
//                else
//                {
//                    btn.fl_badgeValue = [NSString stringWithFormat:@"%d",count];
//                    
//                }
            }
            else
            {
            }
        }
    } onError:^(NSError *error){
        [self closeLoadView];
    }];
}



@end
